﻿using JuCloudy.Service.Intreface.Pool;
using NHibernate;
using NHibernate.Cfg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JuCloudy.Data.Nhibernate.Provider
{
    class SysVariableSessionProvider : IResourceProvider<ISession>
    {
        public ISession Request()
        {
            Configuration mCfg = new Configuration();
            mCfg.AddClass(typeof(JuCloudy.Data.Entity.SysVariable));

            NHibernate.ISessionFactory SessionFactory = mCfg.BuildSessionFactory();

            return SessionFactory.OpenSession();
        }

        public void Dispose(ISession resource)
        {
            resource.Dispose();
        }
    }
}
